package br.xraylol.client;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import org.springframework.stereotype.Component;

import br.xraylol.bean.riot.TeamBean;
import br.xraylol.constant.ServiceType;

@Component
public class TeamClient extends GenericClient {
	public TeamClient() {
		super(ServiceType.TEAM);
	}
	
	@SuppressWarnings("unchecked")
	public List<TeamBean> findTeamBySummonerId(Long summonerId) {
		return findAll("/by-summoner/" + summonerId, ArrayList.class);
	}
	
	@SuppressWarnings("unchecked")
	public HashMap<String, TeamBean> findTeams(List<String> teamsId) {
		return findAll("/" + concatTeamsId(teamsId), HashMap.class);
	}
	
	private String concatTeamsId(List<String> teamsId) {
		String teams = "";
		for (String teamId : teamsId) {
			teams += teamId + ",";
		}
		
		return teams;
	}
}
